--[[ 编码: JX-20-23 名称: 入库单-完工回报 作者:HAN 日期:2025-1-29 级别:项目 函数: CompletionReturn 功能: 需要把入库情况反馈给上游系统,根据入库单的创建方式不同向不同的来源报完工 更改记录: --]] jx_base= require( "jx_base" ) jx_api = require ( "jx_external_api") function CompletionReturn ( strLuaDEID ) local nRet, strRetInfo local io_obj = {} nRet, io_obj = m3.GetSysCurEditDataObj( strLuaDEID, "Inbound_Order" ) if (nRet ~= 0) then lua.Error( strLuaDEID, debug.getinfo(1), "获取【出库单】对象属性失败!"..io_obj ) end -- 如果已经报过完工或报工,不需要报完工,如果没完成也不需要执行后面的报告 if ( io_obj.cr_state ~= 0 ) then return end if ( io_obj.create_method == "JW-WMS" ) then nRet, strRetInfo = jx_api.JW_WMS_API_newTrans( strLuaDEID, io_obj.no ) else nRet = 0 end -- 更新出库单的完工回报属性 local curTime = os.date("%Y-%m-%d %H:%M:%S") strCondition = "S_NO = '"..io_obj.no.."'" local strSetAttr if ( nRet == 0 ) then strSetAttr = "N_CR_STATE = 1, S_CR_ERR = '', T_CR = '"..curTime.."'" else lua.Debug( strLuaDEID, debug.getinfo(1), "JW-WMS newTrans接口错误", strRetInfo ) strSetAttr = "N_CR_STATE = 2, S_CR_ERR = 'JW-WMS newTrans接口错误, 详细信息看日志!', T_CR = '"..curTime.."'" end nRet, strRetInfo = mobox.updateDataAttrByCondition( strLuaDEID, "Inbound_Order", strCondition, strSetAttr ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "更新【入库单】完工回报信息失败!"..strRetInfo ) end end